package cn.itsource.order.service.impl;


import cn.itsource.basic.query.BaseQuery;
import cn.itsource.basic.service.impl.BaseServiceImpl;
import cn.itsource.basic.util.AjaxResult;
import cn.itsource.basic.util.GetUserInfoUtil;
import cn.itsource.order.domain.UserAddress;
import cn.itsource.order.mapper.UserAddressMapper;
import cn.itsource.order.service.IUserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class UserAddressServiceImpl extends BaseServiceImpl<UserAddress, BaseQuery> implements IUserAddressService {
    @Autowired
    private UserAddressMapper userAddressMapper;


    @Override
    public AjaxResult 获取用户地址() {

        //1.获取当前登录用户的地址  userId
        Long userId = GetUserInfoUtil.getUserId();

        //2.根据userId查询对应的地址
        return AjaxResult.createSuccess(userAddressMapper.findByUserId(userId));
    }
}
